using Util.Config;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace Util.DataBase
{
    public class OracleContext : IContext
    {
        /// <summary>
        /// 获得数据库访问实例
        /// </summary>
        /// <param name="bol_share_thread">实例是否共享线程</param>
        /// <param name="connString">连接字串</param>
        /// <returns></returns>
        public SqlSugarClient GetDbContext(bool bol_share_thread, string connString)
        {
            SqlSugarClient db;
            db = new SqlSugarClient(
                new ConnectionConfig()
                {
                    ConnectionString = AppSettingConfig.GetConnectionString("TenantContext"),//Config.ConnectionString,
                    DbType = DbType.Oracle,
                    IsAutoCloseConnection = true,
                    IsShardSameThread = bol_share_thread /*Shard Same Thread*/
                }
            );

            return db;
        }
    }
}
